Skip to content

fix: wrap initial overflow ArrowUp to last tab - #1019

Open
nrps9909 wants to merge 1 commit into
react-component:masterfrom
nrps9909:codex/fix-overflow-first-arrow-up
Open

nrps9909 wants to merge 1 commit into
react-component:masterfrom
nrps9909:codex/fix-overflow-first-arrow-up

Conversation

@nrps9909

@nrps9909 nrps9909 commented Aug 27, 2026 •

Copy link
Copy Markdown

When the overflow menu opens with no selected key, findIndex returns -1. The first ArrowUp then targets the second-to-last enabled tab instead of wrapping to the last. This fix normalizes that initial index for upward navigation while preserving first ArrowDown behavior and skipping disabled tabs.

The regression opens the overflow menu and presses ArrowUp against a sequence containing a disabled tab. It expects the last enabled tab (miu). The patch is based on current master 822d74dd7c706777b1dcd47eacdf1f1be555e57e and preserves the new dropdown open API, renderable guards and scroll-position support.

Local validation on Node 26.10.0 / pnpm 11.21.0 / React 19.3.0 / TypeScript 6.0.3:

  • Base plus regression: 1 failure (cute instead of miu), 111 passes / 3 snapshots.
  • Signed head 8d552e0503adf33651e352a8873a04a94def1071: all 6 suites / 112 tests / 3 snapshots pass.
  • TypeScript, full lint (0 errors, 16 existing warnings), ESM/CJS/declaration and Less compilation, focused Prettier and diff checks pass.

The final diff is limited to the original two files (34 insertions, 1 deletion). These local results are separate from upstream CI and maintainer review; the PR remains open.

AI assistance disclosure: Codex helped reconcile the upstream overflow-test changes, reproduce the base failure, validate the fixed branch and prepare this report. The diff and test results were checked directly.

Summary by CodeRabbit

  • Bug 修复

    • 修复下拉标签导航中使用向上箭头时的选中位置问题。
    • 未选中任何标签时,向下键后再按向上键会选中最后一个启用的标签。
  • 测试

    • 新增键盘导航测试,验证上述操作可选中最后一个启用的标签。

@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

@nrps9909 is attempting to deploy a commit to the afc163's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: c2992e05-1aa3-48bf-af7b-c5b7b0e5575a

📥 Commits

Reviewing files that changed from the base of the PR and between 50af9a7 and 8d552e0.

📒 Files selected for processing (2)
  • src/TabNavList/OperationNode.tsx
  • tests/overflow.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.


Walkthrough

调整溢出菜单键盘导航在未找到当前选中项时的索引处理。新增测试,验证依次按向下键和向上键后选中最后一个启用标签。

Changes

溢出菜单键盘导航

Layer / File(s) Summary
更新导航索引并验证
src/TabNavList/OperationNode.tsx, tests/overflow.test.tsx
当未找到当前选中项且偏移量为 -1 时,selectOffset 将起始索引设为 0。新增测试验证先按向下键、再按向上键后选中最后一个启用标签 miu。

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Suggested reviewers: emilyyyliu

Merge Risk: ⚪ Minimal · up to 8d552

The overflow menu now wraps to the last enabled tab on the first ArrowUp press, while ArrowDown retains its first-item behavior. No material merge risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确描述了溢出菜单首次按下 ArrowUp 时跳转到最后一个标签的修复,与代码变更和回归测试一致。
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

兔子按下向下键,
再按向上键查看。
miu 成为选中项,
索引依条件更新。
测试记下这一步。

Comment @coderabbitai help to get the list of available commands.

@nrps9909
nrps9909 force-pushed the codex/fix-overflow-first-arrow-up branch from 50af9a7 to 8d552e0 Compare October 1, 2026 02:23
@nrps9909

nrps9909 commented Oct 1, 2026

Copy link
Copy Markdown
Author

Resolved the conflict on current master 822d74dd7c706777b1dcd47eacdf1f1be555e57e at signed head 8d552e0503adf33651e352a8873a04a94def1071. The original two-file fix and regression are retained, alongside the new dropdown open API, renderable guards and scroll-position tests.

Base with the regression fails once (cute instead of the last enabled tab miu), with 111 other tests passing. The fixed head passes all 6 suites / 112 tests / 3 snapshots. TypeScript, full lint (0 errors, 16 existing warnings), ESM/CJS/declaration and Less compilation, formatting and diff checks pass. This preserves first ArrowDown behavior and disabled-tab skipping. Local validation remains separate from upstream CI/review. AI assistance: Codex helped resolve the test conflict and run the checks.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant